package com.xu.cloud.common.process;

import org.springframework.beans.factory.FactoryBean;

/**
 * XuApi FactoryBean, 创建代理对象
 *
 * @author xuguan
 * @since 2025/1/20
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public abstract class AbsXuApiFactoryBean<T> implements FactoryBean<T> {
    private Class<T> target;
    private IProcessSelector processSelector;

    public Class<T> getTarget() {
        return target;
    }

    public void setTarget(Class<T> target) {
        this.target = target;
    }

    public IProcessSelector getProcessSelector() {
        return processSelector;
    }

    public void setProcessSelector(IProcessSelector processSelector) {
        this.processSelector = processSelector;
    }

    @Override
    public T getObject() throws Exception {
        return getProxy();
    }

    protected abstract T getProxy();

    @Override
    public Class<?> getObjectType() {
        return target;
    }
}
